#include"BinaryTree.h"
void test01()
{
	BTNode* NodeA=BuyNode('A');
	BTNode* NodeB=BuyNode('B');
	BTNode* NodeC=BuyNode('C');
	BTNode* NodeD=BuyNode('D');
	BTNode* NodeE=BuyNode('E');
	BTNode* NodeF=BuyNode('F');
	NodeA->left=NodeB;
	NodeA->right=NodeC;
	NodeB->left=NodeD;
	NodeC->left=NodeE;
	NodeC->right=NodeF;
	//preOrder(NodeA);
	//inOrder(NodeA);
	//postOrder(NodeA);
	printf("size:%d\n",BinaryTreeSize(NodeA));
	printf("leafsize:%d\n",BinaryTreeLeafSize(NodeA));
	printf("Ksize:%d\n",BinaryTreeLevelKSize(NodeA,3));
	printf("Depth:%d\n",BinaryTreeDepth(NodeA));
	BTNode* Find=BinaryTreeFind(NodeA,'E');
	if(Find)
	{
		printf("找到了！\n");
	}else{
		printf("未找到\n");
	}

	 BinaryTreeDestory(&NodeA);
	
}
void test02()
{
	BTNode* NodeA=BuyNode('A');
	BTNode* NodeB=BuyNode('B');
	BTNode* NodeC=BuyNode('C');
	BTNode* NodeD=BuyNode('D');
	BTNode* NodeE=BuyNode('E');
	BTNode* NodeF=BuyNode('F');
	NodeA->left=NodeB;
	NodeA->right=NodeC;
	NodeB->left=NodeD;
	NodeC->left=NodeE;
	NodeC->right=NodeF;	
	//LevelOrder(NodeA);
	bool ret=BinaryTreeComplete(NodeA);
	if(ret==true)
	{
		printf("是完全二叉树！");
	}else{
		printf("不是完全二叉树！");
	}
	BinaryTreeDestory(&NodeA);
}
void test03()
{
	//建立数组存储数据
    char* arr=(char*)malloc(100*sizeof(int));
    scanf("%s",arr);
    //建立二叉树
    int i=0;
    BTNode* root=creatTree(arr,&i);
    inOrder(root);
}
int main()
{
	//test01();
	//test02();
	test03();
	return 0;
}
